| Conditions | 1 |
| Total Lines | 19 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import React from 'react'; |
||
| 10 | |||
| 11 | export default function serverSideRender() { |
||
| 12 | const history = createMemoryHistory(); |
||
| 13 | const store = setupStore(history); |
||
| 14 | const state = store.getState(); |
||
| 15 | |||
| 16 | const rendered = renderToString( |
||
| 17 | <Provider store={store}> |
||
| 18 | <ConnectedRouter history={history}> |
||
| 19 | <Router /> |
||
| 20 | </ConnectedRouter> |
||
| 21 | </Provider>, |
||
| 22 | ); |
||
| 23 | |||
| 24 | const page = template |
||
| 25 | .replace('<!-- CONTENT -->', rendered) |
||
| 26 | .replace('"-- STORES --"', JSON.stringify(state)); |
||
| 27 | |||
| 28 | return page; |
||
| 29 | } |
||
| 30 |